<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/github.css" type="text/css" media="screen" />
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter 
            
                <span class="parent">&lt; 
                    
                    <a href="AbstractAdapter.html">ActiveRecord::ConnectionAdapters::AbstractAdapter</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../../files/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter_rb.html">activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  
    <!-- Namespace -->
    <div class="sectiontitle">Namespace</div>
    <ul>
      
        <li>
          <span class="type">CLASS</span>
          <a href="AbstractMysqlAdapter/SchemaCreation.html">ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::SchemaCreation</a>
        </li>
      
    </ul>
  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>A</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-add_column_position-21">add_column_position!</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-add_column_sql">add_column_sql</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-add_index_length">add_index_length</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-add_index_sql">add_index_sql</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-add_timestamps_sql">add_timestamps_sql</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>B</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-begin_db_transaction">begin_db_transaction</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-begin_isolated_db_transaction">begin_isolated_db_transaction</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-case_insensitive_comparison">case_insensitive_comparison</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-case_sensitive_modifier">case_sensitive_modifier</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-change_column_default">change_column_default</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-change_column_null">change_column_null</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-change_column_sql">change_column_sql</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-charset">charset</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-collation">collation</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-create_database">create_database</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-create_savepoint">create_savepoint</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-current_database">current_database</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-empty_insert_statement_value">empty_insert_statement_value</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-c-emulate_booleans">emulate_booleans</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-execute">execute</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-index_algorithms">index_algorithms</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>L</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-limited_update_conditions">limited_update_conditions</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>N</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-native_database_types">native_database_types</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-c-new">new</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>P</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-pk_and_sequence_for">pk_and_sequence_for</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-primary_key">primary_key</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>Q</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-quote">quote</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-quoted_columns_for_index">quoted_columns_for_index</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-quoted_false">quoted_false</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-quoted_true">quoted_true</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>R</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-recreate_database">recreate_database</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-release_savepoint">release_savepoint</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-remove_column_sql">remove_column_sql</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-remove_columns_sql">remove_columns_sql</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-remove_index_sql">remove_index_sql</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-remove_timestamps_sql">remove_timestamps_sql</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-rename_column_sql">rename_column_sql</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-rename_table">rename_table</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-rollback_to_savepoint">rollback_to_savepoint</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-schema_creation">schema_creation</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-show_variable">show_variable</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-strict_mode-3F">strict_mode?</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-subquery_for">subquery_for</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-supports_index_sort_order-3F">supports_index_sort_order?</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-supports_migrations-3F">supports_migrations?</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-supports_primary_key-3F">supports_primary_key?</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-supports_savepoints-3F">supports_savepoints?</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-supports_transaction_isolation-3F">supports_transaction_isolation?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-table_exists-3F">table_exists?</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-translate_exception">translate_exception</a>,
              </li>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-type_to_sql">type_to_sql</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>V</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="AbstractMysqlAdapter.html#method-i-valid_type-3F">valid_type?</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">LOST_CONNECTION_ERROR_MESSAGES</td>
            <td>=</td>
            <td class="attr-value">[
&quot;Server shutdown in progress&quot;,
&quot;Broken pipe&quot;,
&quot;Lost connection to MySQL server during query&quot;,
&quot;MySQL server has gone away&quot; ]</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">QUOTED_FALSE</td>
            <td>=</td>
            <td class="attr-value">'1', '0'</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">NATIVE_DATABASE_TYPES</td>
            <td>=</td>
            <td class="attr-value">{
:primary_key =&gt; &quot;int(11) DEFAULT NULL auto_increment PRIMARY KEY&quot;,
:string      =&gt; { :name =&gt; &quot;varchar&quot;, :limit =&gt; 255 },
:text        =&gt; { :name =&gt; &quot;text&quot; },
:integer     =&gt; { :name =&gt; &quot;int&quot;, :limit =&gt; 4 },
:float       =&gt; { :name =&gt; &quot;float&quot; },
:decimal     =&gt; { :name =&gt; &quot;decimal&quot; },
:datetime    =&gt; { :name =&gt; &quot;datetime&quot; },
:timestamp   =&gt; { :name =&gt; &quot;datetime&quot; },
:time        =&gt; { :name =&gt; &quot;time&quot; },
:date        =&gt; { :name =&gt; &quot;date&quot; },
:binary      =&gt; { :name =&gt; &quot;blob&quot; },
:boolean     =&gt; { :name =&gt; &quot;tinyint&quot;, :limit =&gt; 1 }
}</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">INDEX_TYPES</td>
            <td>=</td>
            <td class="attr-value">[:fulltext, :spatial]</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">INDEX_USINGS</td>
            <td>=</td>
            <td class="attr-value">[:btree, :hash]</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-emulate_booleans">
            
              <b>emulate_booleans</b>
            
            <a href="AbstractMysqlAdapter.html#method-c-emulate_booleans" name="method-c-emulate_booleans" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>By default, the <a href="MysqlAdapter.html">MysqlAdapter</a> will consider
all columns of type <code>tinyint(1)</code> as boolean. If you wish to
disable this emulation (which was the default behavior in versions 0.13.1
and earlier) you can add the following line to your application.rb file:</p>

<pre>ActiveRecord::ConnectionAdapters::Mysql[2]Adapter.emulate_booleans = false</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-emulate_booleans_source')" id="l_method-c-emulate_booleans_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L128" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-emulate_booleans_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 128</span>
<span class="ruby-identifier">class_attribute</span> <span class="ruby-value">:emulate_booleans</span>
</pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-new">
            
              <b>new</b>(connection, logger, connection_options, config)
            
            <a href="AbstractMysqlAdapter.html#method-c-new" name="method-c-new" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>FIXME: Make the first parameter more similar for the two adapters</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L162" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-new_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 162</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">connection</span>, <span class="ruby-identifier">logger</span>, <span class="ruby-identifier">connection_options</span>, <span class="ruby-identifier">config</span>)
  <span class="ruby-keyword">super</span>(<span class="ruby-identifier">connection</span>, <span class="ruby-identifier">logger</span>)
  <span class="ruby-ivar">@connection_options</span>, <span class="ruby-ivar">@config</span> = <span class="ruby-identifier">connection_options</span>, <span class="ruby-identifier">config</span>
  <span class="ruby-ivar">@quoted_column_names</span>, <span class="ruby-ivar">@quoted_table_names</span> = {}, {}

  <span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">type_cast_config_to_boolean</span>(<span class="ruby-identifier">config</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:prepared_statements</span>) { <span class="ruby-keyword">true</span> })
    <span class="ruby-ivar">@visitor</span> = <span class="ruby-constant">Arel</span><span class="ruby-operator">::</span><span class="ruby-constant">Visitors</span><span class="ruby-operator">::</span><span class="ruby-constant">MySQL</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">self</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-ivar">@visitor</span> = <span class="ruby-identifier">unprepared_visitor</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-add_column_position-21">
            
              <b>add_column_position!</b>(sql, options)
            
            <a href="AbstractMysqlAdapter.html#method-i-add_column_position-21" name="method-i-add_column_position-21" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-add_column_position-21_source')" id="l_method-i-add_column_position-21_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L557" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-add_column_position-21_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 557</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">add_column_position!</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:first</span>]
    <span class="ruby-identifier">sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-string">&quot; FIRST&quot;</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:after</span>]
    <span class="ruby-identifier">sql</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; AFTER #{quote_column_name(options[:after])}&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-begin_db_transaction">
            
              <b>begin_db_transaction</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-begin_db_transaction" name="method-i-begin_db_transaction" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-begin_db_transaction_source')" id="l_method-i-begin_db_transaction_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L308" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-begin_db_transaction_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 308</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">begin_db_transaction</span>
  <span class="ruby-identifier">execute</span> <span class="ruby-string">&quot;BEGIN&quot;</span>
<span class="ruby-keyword">rescue</span>
  <span class="ruby-comment"># Transactions aren't supported</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-begin_isolated_db_transaction">
            
              <b>begin_isolated_db_transaction</b>(isolation)
            
            <a href="AbstractMysqlAdapter.html#method-i-begin_isolated_db_transaction" name="method-i-begin_isolated_db_transaction" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-begin_isolated_db_transaction_source')" id="l_method-i-begin_isolated_db_transaction_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L314" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-begin_isolated_db_transaction_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 314</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">begin_isolated_db_transaction</span>(<span class="ruby-identifier">isolation</span>)
  <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;SET TRANSACTION ISOLATION LEVEL #{transaction_isolation_levels.fetch(isolation)}&quot;</span>
  <span class="ruby-identifier">begin_db_transaction</span>
<span class="ruby-keyword">rescue</span>
  <span class="ruby-comment"># Transactions aren't supported</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-case_insensitive_comparison">
            
              <b>case_insensitive_comparison</b>(table, attribute, column, value)
            
            <a href="AbstractMysqlAdapter.html#method-i-case_insensitive_comparison" name="method-i-case_insensitive_comparison" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-case_insensitive_comparison_source')" id="l_method-i-case_insensitive_comparison_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L594" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-case_insensitive_comparison_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 594</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">case_insensitive_comparison</span>(<span class="ruby-identifier">table</span>, <span class="ruby-identifier">attribute</span>, <span class="ruby-identifier">column</span>, <span class="ruby-identifier">value</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">case_sensitive?</span>
    <span class="ruby-keyword">super</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">table</span>[<span class="ruby-identifier">attribute</span>].<span class="ruby-identifier">eq</span>(<span class="ruby-identifier">value</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-case_sensitive_modifier">
            
              <b>case_sensitive_modifier</b>(node)
            
            <a href="AbstractMysqlAdapter.html#method-i-case_sensitive_modifier" name="method-i-case_sensitive_modifier" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-case_sensitive_modifier_source')" id="l_method-i-case_sensitive_modifier_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L590" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-case_sensitive_modifier_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 590</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">case_sensitive_modifier</span>(<span class="ruby-identifier">node</span>)
  <span class="ruby-constant">Arel</span><span class="ruby-operator">::</span><span class="ruby-constant">Nodes</span><span class="ruby-operator">::</span><span class="ruby-constant">Bin</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">node</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-change_column_default">
            
              <b>change_column_default</b>(table_name, column_name, default)
            
            <a href="AbstractMysqlAdapter.html#method-i-change_column_default" name="method-i-change_column_default" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-change_column_default_source')" id="l_method-i-change_column_default_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L496" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-change_column_default_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 496</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">change_column_default</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">default</span>)
  <span class="ruby-identifier">column</span> = <span class="ruby-identifier">column_for</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>)
  <span class="ruby-identifier">change_column</span> <span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">column</span>.<span class="ruby-identifier">sql_type</span>, <span class="ruby-value">:default</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">default</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-change_column_null">
            
              <b>change_column_null</b>(table_name, column_name, null, default = nil)
            
            <a href="AbstractMysqlAdapter.html#method-i-change_column_null" name="method-i-change_column_null" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-change_column_null_source')" id="l_method-i-change_column_null_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L501" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-change_column_null_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 501</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">change_column_null</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">null</span>, <span class="ruby-identifier">default</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">column</span> = <span class="ruby-identifier">column_for</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>)

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">null</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">default</span>.<span class="ruby-identifier">nil?</span>
    <span class="ruby-identifier">execute</span>(<span class="ruby-node">&quot;UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(column_name)}=#{quote(default)} WHERE #{quote_column_name(column_name)} IS NULL&quot;</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">change_column</span> <span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">column</span>.<span class="ruby-identifier">sql_type</span>, <span class="ruby-value">:null</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">null</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-charset">
            
              <b>charset</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-charset" name="method-i-charset" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the database character set.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-charset_source')" id="l_method-i-charset_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L400" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-charset_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 400</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">charset</span>
  <span class="ruby-identifier">show_variable</span> <span class="ruby-string">'character_set_database'</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-collation">
            
              <b>collation</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-collation" name="method-i-collation" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the database collation strategy.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-collation_source')" id="l_method-i-collation_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L405" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-collation_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 405</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">collation</span>
  <span class="ruby-identifier">show_variable</span> <span class="ruby-string">'collation_database'</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-create_database">
            
              <b>create_database</b>(name, options = {})
            
            <a href="AbstractMysqlAdapter.html#method-i-create_database" name="method-i-create_database" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Create a new MySQL database with optional <code>:charset</code> and
<code>:collation</code>. Charset defaults to utf8.</p>

<p>Example:</p>

<pre>create_database 'charset_test', charset: 'latin1', collation: 'latin1_bin'
create_database 'matt_development'
create_database 'matt_development', charset: :big5</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-create_database_source')" id="l_method-i-create_database_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L379" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-create_database_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 379</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">create_database</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:collation</span>]
    <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;CREATE DATABASE `#{name}` DEFAULT CHARACTER SET `#{options[:charset] || 'utf8'}` COLLATE `#{options[:collation]}`&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;CREATE DATABASE `#{name}` DEFAULT CHARACTER SET `#{options[:charset] || 'utf8'}`&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-create_savepoint">
            
              <b>create_savepoint</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-create_savepoint" name="method-i-create_savepoint" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-create_savepoint_source')" id="l_method-i-create_savepoint_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L333" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-create_savepoint_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 333</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">create_savepoint</span>
  <span class="ruby-identifier">execute</span>(<span class="ruby-node">&quot;SAVEPOINT #{current_savepoint_name}&quot;</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-current_database">
            
              <b>current_database</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-current_database" name="method-i-current_database" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-current_database_source')" id="l_method-i-current_database_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L395" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-current_database_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 395</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">current_database</span>
  <span class="ruby-identifier">select_value</span> <span class="ruby-string">'SELECT DATABASE() as db'</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-empty_insert_statement_value">
            
              <b>empty_insert_statement_value</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-empty_insert_statement_value" name="method-i-empty_insert_statement_value" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-empty_insert_statement_value_source')" id="l_method-i-empty_insert_statement_value_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L357" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-empty_insert_statement_value_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 357</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">empty_insert_statement_value</span>
  <span class="ruby-string">&quot;VALUES ()&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-execute">
            
              <b>execute</b>(sql, name = nil)
            
            <a href="AbstractMysqlAdapter.html#method-i-execute" name="method-i-execute" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Executes the SQL statement in the context of this connection.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-execute_source')" id="l_method-i-execute_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L282" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-execute_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 282</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">execute</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-identifier">name</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value">:skip_logging</span>
    <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">sql</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">log</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-identifier">name</span>) { <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">sql</span>) }
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">StatementInvalid</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;:&quot;</span>).<span class="ruby-identifier">first</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/Packets out of order/</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">StatementInvalid</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&quot;'Packets out of order' error was received from the database. Please update your mysql bindings (gem install mysql) and read http://dev.mysql.com/doc/mysql/en/password-hashing.html for more information. If you're on Windows, use the Instant Rails installer to get the updated mysql bindings.&quot;</span>, <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">original_exception</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-index_algorithms">
            
              <b>index_algorithms</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-index_algorithms" name="method-i-index_algorithms" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-index_algorithms_source')" id="l_method-i-index_algorithms_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L214" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-index_algorithms_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 214</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">index_algorithms</span>
  { <span class="ruby-identifier">default</span><span class="ruby-operator">:</span> <span class="ruby-string">'ALGORITHM = DEFAULT'</span>, <span class="ruby-identifier">copy</span><span class="ruby-operator">:</span> <span class="ruby-string">'ALGORITHM = COPY'</span>, <span class="ruby-identifier">inplace</span><span class="ruby-operator">:</span> <span class="ruby-string">'ALGORITHM = INPLACE'</span> }
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-limited_update_conditions">
            
              <b>limited_update_conditions</b>(where_sql, quoted_table_name, quoted_primary_key)
            
            <a href="AbstractMysqlAdapter.html#method-i-limited_update_conditions" name="method-i-limited_update_conditions" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-limited_update_conditions_source')" id="l_method-i-limited_update_conditions_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L602" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-limited_update_conditions_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 602</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">limited_update_conditions</span>(<span class="ruby-identifier">where_sql</span>, <span class="ruby-identifier">quoted_table_name</span>, <span class="ruby-identifier">quoted_primary_key</span>)
  <span class="ruby-identifier">where_sql</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-native_database_types">
            
              <b>native_database_types</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-native_database_types" name="method-i-native_database_types" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-native_database_types_source')" id="l_method-i-native_database_types_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L210" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-native_database_types_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 210</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">native_database_types</span>
  <span class="ruby-constant">NATIVE_DATABASE_TYPES</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-pk_and_sequence_for">
            
              <b>pk_and_sequence_for</b>(table)
            
            <a href="AbstractMysqlAdapter.html#method-i-pk_and_sequence_for" name="method-i-pk_and_sequence_for" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a table’s primary key and belonging sequence.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-pk_and_sequence_for_source')" id="l_method-i-pk_and_sequence_for_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L572" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-pk_and_sequence_for_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 572</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">pk_and_sequence_for</span>(<span class="ruby-identifier">table</span>)
  <span class="ruby-identifier">execute_and_free</span>(<span class="ruby-node">&quot;SHOW CREATE TABLE #{quote_table_name(table)}&quot;</span>, <span class="ruby-string">'SCHEMA'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">result</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">create_table</span> = <span class="ruby-identifier">each_hash</span>(<span class="ruby-identifier">result</span>).<span class="ruby-identifier">first</span>[<span class="ruby-value">:&quot;Create Table&quot;</span>]
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">create_table</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/PRIMARY KEY\s+(?:USING\s+\w+\s+)?\((.+)\)/</span>
      <span class="ruby-identifier">keys</span> = <span class="ruby-node">$1</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;,&quot;</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-string">'`&quot;'</span>) }
      <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-number">1</span> <span class="ruby-operator">?</span> [<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">first</span>, <span class="ruby-keyword">nil</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">nil</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-primary_key">
            
              <b>primary_key</b>(table)
            
            <a href="AbstractMysqlAdapter.html#method-i-primary_key" name="method-i-primary_key" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns just a table’s primary key</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-primary_key_source')" id="l_method-i-primary_key_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L585" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-primary_key_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 585</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">primary_key</span>(<span class="ruby-identifier">table</span>)
  <span class="ruby-identifier">pk_and_sequence</span> = <span class="ruby-identifier">pk_and_sequence_for</span>(<span class="ruby-identifier">table</span>)
  <span class="ruby-identifier">pk_and_sequence</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">pk_and_sequence</span>.<span class="ruby-identifier">first</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-quote">
            
              <b>quote</b>(value, column = nil)
            
            <a href="AbstractMysqlAdapter.html#method-i-quote" name="method-i-quote" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>QUOTING ==================================================</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-quote_source')" id="l_method-i-quote_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L239" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-quote_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 239</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">quote</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">column</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">String</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">column</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value">:binary</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:string_to_binary</span>)
    <span class="ruby-identifier">s</span> = <span class="ruby-identifier">column</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">string_to_binary</span>(<span class="ruby-identifier">value</span>).<span class="ruby-identifier">unpack</span>(<span class="ruby-string">&quot;H*&quot;</span>)[<span class="ruby-number">0</span>]
    <span class="ruby-node">&quot;x'#{s}'&quot;</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">BigDecimal</span>)
    <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-string">&quot;F&quot;</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">super</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-quoted_false">
            
              <b>quoted_false</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-quoted_false" name="method-i-quoted_false" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-quoted_false_source')" id="l_method-i-quoted_false_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L262" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-quoted_false_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 262</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">quoted_false</span>
  <span class="ruby-constant">QUOTED_FALSE</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-quoted_true">
            
              <b>quoted_true</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-quoted_true" name="method-i-quoted_true" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-quoted_true_source')" id="l_method-i-quoted_true_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L258" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-quoted_true_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 258</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">quoted_true</span>
  <span class="ruby-constant">QUOTED_TRUE</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-recreate_database">
            
              <b>recreate_database</b>(name, options = {})
            
            <a href="AbstractMysqlAdapter.html#method-i-recreate_database" name="method-i-recreate_database" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Drops the database specified on the <code>name</code> attribute and creates
it again using the provided <code>options</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-recreate_database_source')" id="l_method-i-recreate_database_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L365" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-recreate_database_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 365</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">recreate_database</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">drop_database</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">sql</span> = <span class="ruby-identifier">create_database</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">reconnect!</span>
  <span class="ruby-identifier">sql</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-release_savepoint">
            
              <b>release_savepoint</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-release_savepoint" name="method-i-release_savepoint" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-release_savepoint_source')" id="l_method-i-release_savepoint_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L341" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-release_savepoint_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 341</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">release_savepoint</span>
  <span class="ruby-identifier">execute</span>(<span class="ruby-node">&quot;RELEASE SAVEPOINT #{current_savepoint_name}&quot;</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-rename_table">
            
              <b>rename_table</b>(table_name, new_name)
            
            <a href="AbstractMysqlAdapter.html#method-i-rename_table" name="method-i-rename_table" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Renames a table.</p>

<p>Example:</p>

<pre>rename_table('octopuses', 'octopi')</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-rename_table_source')" id="l_method-i-rename_table_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L491" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-rename_table_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 491</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">rename_table</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">new_name</span>)
  <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;RENAME TABLE #{quote_table_name(table_name)} TO #{quote_table_name(new_name)}&quot;</span>
  <span class="ruby-identifier">rename_table_indexes</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">new_name</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-rollback_to_savepoint">
            
              <b>rollback_to_savepoint</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-rollback_to_savepoint" name="method-i-rollback_to_savepoint" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-rollback_to_savepoint_source')" id="l_method-i-rollback_to_savepoint_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L337" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-rollback_to_savepoint_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 337</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">rollback_to_savepoint</span>
  <span class="ruby-identifier">execute</span>(<span class="ruby-node">&quot;ROLLBACK TO SAVEPOINT #{current_savepoint_name}&quot;</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-schema_creation">
            
              <b>schema_creation</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-schema_creation" name="method-i-schema_creation" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-schema_creation_source')" id="l_method-i-schema_creation_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L23" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-schema_creation_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">schema_creation</span>
  <span class="ruby-constant">SchemaCreation</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-show_variable">
            
              <b>show_variable</b>(name)
            
            <a href="AbstractMysqlAdapter.html#method-i-show_variable" name="method-i-show_variable" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>SHOW VARIABLES LIKE ‘name’</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-show_variable_source')" id="l_method-i-show_variable_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L566" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-show_variable_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 566</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">show_variable</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">variables</span> = <span class="ruby-identifier">select_all</span>(<span class="ruby-node">&quot;SHOW VARIABLES LIKE '#{name}'&quot;</span>, <span class="ruby-string">'SCHEMA'</span>)
  <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">first</span>[<span class="ruby-string">'Value'</span>] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-strict_mode-3F">
            
              <b>strict_mode?</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-strict_mode-3F" name="method-i-strict_mode-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-strict_mode-3F_source')" id="l_method-i-strict_mode-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L606" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-strict_mode-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 606</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">strict_mode?</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">type_cast_config_to_boolean</span>(<span class="ruby-ivar">@config</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:strict</span>, <span class="ruby-keyword">true</span>))
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-supports_index_sort_order-3F">
            
              <b>supports_index_sort_order?</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-supports_index_sort_order-3F" name="method-i-supports_index_sort_order-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Technically MySQL allows to create indexes with the sort order syntax but
at the moment (5.5) it doesn’t yet implement them</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-supports_index_sort_order-3F_source')" id="l_method-i-supports_index_sort_order-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L198" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-supports_index_sort_order-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 198</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">supports_index_sort_order?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-supports_migrations-3F">
            
              <b>supports_migrations?</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-supports_migrations-3F" name="method-i-supports_migrations-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns true, since this connection adapter supports migrations.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-supports_migrations-3F_source')" id="l_method-i-supports_migrations-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L179" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-supports_migrations-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 179</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">supports_migrations?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-supports_primary_key-3F">
            
              <b>supports_primary_key?</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-supports_primary_key-3F" name="method-i-supports_primary_key-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-supports_primary_key-3F_source')" id="l_method-i-supports_primary_key-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L183" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-supports_primary_key-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 183</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">supports_primary_key?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-supports_savepoints-3F">
            
              <b>supports_savepoints?</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-supports_savepoints-3F" name="method-i-supports_savepoints-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns true, since this connection adapter supports savepoints.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-supports_savepoints-3F_source')" id="l_method-i-supports_savepoints-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L188" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-supports_savepoints-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 188</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">supports_savepoints?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-supports_transaction_isolation-3F">
            
              <b>supports_transaction_isolation?</b>()
            
            <a href="AbstractMysqlAdapter.html#method-i-supports_transaction_isolation-3F" name="method-i-supports_transaction_isolation-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>MySQL 4 technically support transaction isolation, but it is affected by a
bug where the transaction level gets persisted for the whole session:</p>

<p><a
href="http://bugs.mysql.com/bug.php?id=39170">bugs.mysql.com/bug.php?id=39170</a></p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-supports_transaction_isolation-3F_source')" id="l_method-i-supports_transaction_isolation-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L206" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-supports_transaction_isolation-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 206</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">supports_transaction_isolation?</span>
  <span class="ruby-identifier">version</span>[<span class="ruby-number">0</span>] <span class="ruby-operator">&gt;=</span> <span class="ruby-number">5</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-table_exists-3F">
            
              <b>table_exists?</b>(name)
            
            <a href="AbstractMysqlAdapter.html#method-i-table_exists-3F" name="method-i-table_exists-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-table_exists-3F_source')" id="l_method-i-table_exists-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L419" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-table_exists-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 419</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">table_exists?</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">name</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">tables</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">name</span>).<span class="ruby-identifier">any?</span>

  <span class="ruby-identifier">name</span>          = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-identifier">schema</span>, <span class="ruby-identifier">table</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'.'</span>, <span class="ruby-number">2</span>)

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">table</span> <span class="ruby-comment"># A table was provided without a schema</span>
    <span class="ruby-identifier">table</span>  = <span class="ruby-identifier">schema</span>
    <span class="ruby-identifier">schema</span> = <span class="ruby-keyword">nil</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">tables</span>(<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">schema</span>, <span class="ruby-identifier">table</span>).<span class="ruby-identifier">any?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-type_to_sql">
            
              <b>type_to_sql</b>(type, limit = nil, precision = nil, scale = nil)
            
            <a href="AbstractMysqlAdapter.html#method-i-type_to_sql" name="method-i-type_to_sql" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Maps logical <a href="../../Rails.html">Rails</a> types to MySQL-specific
data types.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-type_to_sql_source')" id="l_method-i-type_to_sql_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L526" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-type_to_sql_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 526</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">type_to_sql</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">precision</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">scale</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'binary'</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">limit</span>
    <span class="ruby-keyword">when</span> <span class="ruby-number">0</span><span class="ruby-operator">..</span><span class="ruby-number">0xfff</span>;           <span class="ruby-node">&quot;varbinary(#{limit})&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>;                <span class="ruby-string">&quot;blob&quot;</span>
    <span class="ruby-keyword">when</span> <span class="ruby-number">0x1000</span><span class="ruby-operator">..</span><span class="ruby-number">0xffffffff</span>; <span class="ruby-node">&quot;blob(#{limit})&quot;</span>
    <span class="ruby-keyword">else</span> <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ActiveRecordError</span>, <span class="ruby-node">&quot;No binary type has character length #{limit}&quot;</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'integer'</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">limit</span>
    <span class="ruby-keyword">when</span> <span class="ruby-number">1</span>; <span class="ruby-string">'tinyint'</span>
    <span class="ruby-keyword">when</span> <span class="ruby-number">2</span>; <span class="ruby-string">'smallint'</span>
    <span class="ruby-keyword">when</span> <span class="ruby-number">3</span>; <span class="ruby-string">'mediumint'</span>
    <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>, <span class="ruby-number">4</span>, <span class="ruby-number">11</span>; <span class="ruby-string">'int(11)'</span>  <span class="ruby-comment"># compatibility with MySQL default</span>
    <span class="ruby-keyword">when</span> <span class="ruby-number">5</span><span class="ruby-operator">..</span><span class="ruby-number">8</span>; <span class="ruby-string">'bigint'</span>
    <span class="ruby-keyword">else</span> <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ActiveRecordError</span>, <span class="ruby-node">&quot;No integer type has byte size #{limit}&quot;</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">when</span> <span class="ruby-string">'text'</span>
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">limit</span>
    <span class="ruby-keyword">when</span> <span class="ruby-number">0</span><span class="ruby-operator">..</span><span class="ruby-number">0xff</span>;               <span class="ruby-string">'tinytext'</span>
    <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>, <span class="ruby-number">0x100</span><span class="ruby-operator">..</span><span class="ruby-number">0xffff</span>;    <span class="ruby-string">'text'</span>
    <span class="ruby-keyword">when</span> <span class="ruby-number">0x10000</span><span class="ruby-operator">..</span><span class="ruby-number">0xffffff</span>;     <span class="ruby-string">'mediumtext'</span>
    <span class="ruby-keyword">when</span> <span class="ruby-number">0x1000000</span><span class="ruby-operator">..</span><span class="ruby-number">0xffffffff</span>; <span class="ruby-string">'longtext'</span>
    <span class="ruby-keyword">else</span> <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ActiveRecordError</span>, <span class="ruby-node">&quot;No text type has character length #{limit}&quot;</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">super</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-valid_type-3F">
            
              <b>valid_type?</b>(type)
            
            <a href="AbstractMysqlAdapter.html#method-i-valid_type-3F" name="method-i-valid_type-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-valid_type-3F_source')" id="l_method-i-valid_type-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L610" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-valid_type-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 610</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">valid_type?</span>(<span class="ruby-identifier">type</span>)
  <span class="ruby-operator">!</span><span class="ruby-identifier">native_database_types</span>[<span class="ruby-identifier">type</span>].<span class="ruby-identifier">nil?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
              
      <div class="sectiontitle">Instance Protected methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-add_column_sql">
            
              <b>add_column_sql</b>(table_name, column_name, type, options = {})
            
            <a href="AbstractMysqlAdapter.html#method-i-add_column_sql" name="method-i-add_column_sql" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-add_column_sql_source')" id="l_method-i-add_column_sql_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L663" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-add_column_sql_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 663</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">add_column_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">add_column_sql</span> = <span class="ruby-node">&quot;ADD #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}&quot;</span>
  <span class="ruby-identifier">add_column_options!</span>(<span class="ruby-identifier">add_column_sql</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">add_column_position!</span>(<span class="ruby-identifier">add_column_sql</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">add_column_sql</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-add_index_length">
            
              <b>add_index_length</b>(option_strings, column_names, options = {})
            
            <a href="AbstractMysqlAdapter.html#method-i-add_index_length" name="method-i-add_index_length" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-add_index_length_source')" id="l_method-i-add_index_length_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L627" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-add_index_length_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 627</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">add_index_length</span>(<span class="ruby-identifier">option_strings</span>, <span class="ruby-identifier">column_names</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">length</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:length</span>]
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">length</span>
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Hash</span>
      <span class="ruby-identifier">column_names</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">option_strings</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;(#{length[name]})&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">length</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">length</span>[<span class="ruby-identifier">name</span>].<span class="ruby-identifier">present?</span>}
    <span class="ruby-keyword">when</span> <span class="ruby-constant">Fixnum</span>
      <span class="ruby-identifier">column_names</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">option_strings</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;(#{length})&quot;</span>}
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">return</span> <span class="ruby-identifier">option_strings</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-add_index_sql">
            
              <b>add_index_sql</b>(table_name, column_name, options = {})
            
            <a href="AbstractMysqlAdapter.html#method-i-add_index_sql" name="method-i-add_index_sql" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-add_index_sql_source')" id="l_method-i-add_index_sql_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L712" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-add_index_sql_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 712</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">add_index_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">index_name</span>, <span class="ruby-identifier">index_type</span>, <span class="ruby-identifier">index_columns</span> = <span class="ruby-identifier">add_index_options</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-node">&quot;ADD #{index_type} INDEX #{index_name} (#{index_columns})&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-add_timestamps_sql">
            
              <b>add_timestamps_sql</b>(table_name)
            
            <a href="AbstractMysqlAdapter.html#method-i-add_timestamps_sql" name="method-i-add_timestamps_sql" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-add_timestamps_sql_source')" id="l_method-i-add_timestamps_sql_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L722" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-add_timestamps_sql_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 722</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">add_timestamps_sql</span>(<span class="ruby-identifier">table_name</span>)
  [<span class="ruby-identifier">add_column_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-value">:created_at</span>, <span class="ruby-value">:datetime</span>), <span class="ruby-identifier">add_column_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-value">:updated_at</span>, <span class="ruby-value">:datetime</span>)]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-change_column_sql">
            
              <b>change_column_sql</b>(table_name, column_name, type, options = {})
            
            <a href="AbstractMysqlAdapter.html#method-i-change_column_sql" name="method-i-change_column_sql" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-change_column_sql_source')" id="l_method-i-change_column_sql_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L670" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-change_column_sql_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 670</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">change_column_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">column</span> = <span class="ruby-identifier">column_for</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>)

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">options_include_default?</span>(<span class="ruby-identifier">options</span>)
    <span class="ruby-identifier">options</span>[<span class="ruby-value">:default</span>] = <span class="ruby-identifier">column</span>.<span class="ruby-identifier">default</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">unless</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:null</span>)
    <span class="ruby-identifier">options</span>[<span class="ruby-value">:null</span>] = <span class="ruby-identifier">column</span>.<span class="ruby-identifier">null</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">change_column_sql</span> = <span class="ruby-node">&quot;CHANGE #{quote_column_name(column_name)} #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}&quot;</span>
  <span class="ruby-identifier">add_column_options!</span>(<span class="ruby-identifier">change_column_sql</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">add_column_position!</span>(<span class="ruby-identifier">change_column_sql</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">change_column_sql</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-quoted_columns_for_index">
            
              <b>quoted_columns_for_index</b>(column_names, options = {})
            
            <a href="AbstractMysqlAdapter.html#method-i-quoted_columns_for_index" name="method-i-quoted_columns_for_index" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-quoted_columns_for_index_source')" id="l_method-i-quoted_columns_for_index_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L640" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-quoted_columns_for_index_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 640</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">quoted_columns_for_index</span>(<span class="ruby-identifier">column_names</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">option_strings</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-identifier">column_names</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">name</span>, <span class="ruby-string">''</span>]}]

  <span class="ruby-comment"># add index length</span>
  <span class="ruby-identifier">option_strings</span> = <span class="ruby-identifier">add_index_length</span>(<span class="ruby-identifier">option_strings</span>, <span class="ruby-identifier">column_names</span>, <span class="ruby-identifier">options</span>)

  <span class="ruby-comment"># add index sort order</span>
  <span class="ruby-identifier">option_strings</span> = <span class="ruby-identifier">add_index_sort_order</span>(<span class="ruby-identifier">option_strings</span>, <span class="ruby-identifier">column_names</span>, <span class="ruby-identifier">options</span>)

  <span class="ruby-identifier">column_names</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">quote_column_name</span>(<span class="ruby-identifier">name</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">option_strings</span>[<span class="ruby-identifier">name</span>]}
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-remove_column_sql">
            
              <b>remove_column_sql</b>(table_name, column_name, type = nil, options = {})
            
            <a href="AbstractMysqlAdapter.html#method-i-remove_column_sql" name="method-i-remove_column_sql" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-remove_column_sql_source')" id="l_method-i-remove_column_sql_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L704" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-remove_column_sql_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 704</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">remove_column_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">type</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-node">&quot;DROP #{quote_column_name(column_name)}&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-remove_columns_sql">
            
              <b>remove_columns_sql</b>(table_name, *column_names)
            
            <a href="AbstractMysqlAdapter.html#method-i-remove_columns_sql" name="method-i-remove_columns_sql" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-remove_columns_sql_source')" id="l_method-i-remove_columns_sql_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L708" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-remove_columns_sql_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 708</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">remove_columns_sql</span>(<span class="ruby-identifier">table_name</span>, *<span class="ruby-identifier">column_names</span>)
  <span class="ruby-identifier">column_names</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">column_name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">remove_column_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>) }
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-remove_index_sql">
            
              <b>remove_index_sql</b>(table_name, options = {})
            
            <a href="AbstractMysqlAdapter.html#method-i-remove_index_sql" name="method-i-remove_index_sql" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-remove_index_sql_source')" id="l_method-i-remove_index_sql_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L717" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-remove_index_sql_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 717</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">remove_index_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">index_name</span> = <span class="ruby-identifier">index_name_for_remove</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-node">&quot;DROP INDEX #{index_name}&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-remove_timestamps_sql">
            
              <b>remove_timestamps_sql</b>(table_name)
            
            <a href="AbstractMysqlAdapter.html#method-i-remove_timestamps_sql" name="method-i-remove_timestamps_sql" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-remove_timestamps_sql_source')" id="l_method-i-remove_timestamps_sql_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L726" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-remove_timestamps_sql_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 726</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">remove_timestamps_sql</span>(<span class="ruby-identifier">table_name</span>)
  [<span class="ruby-identifier">remove_column_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-value">:updated_at</span>), <span class="ruby-identifier">remove_column_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-value">:created_at</span>)]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-rename_column_sql">
            
              <b>rename_column_sql</b>(table_name, column_name, new_column_name)
            
            <a href="AbstractMysqlAdapter.html#method-i-rename_column_sql" name="method-i-rename_column_sql" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-rename_column_sql_source')" id="l_method-i-rename_column_sql_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L687" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-rename_column_sql_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 687</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">rename_column_sql</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">new_column_name</span>)
  <span class="ruby-identifier">options</span> = {}

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">column</span> = <span class="ruby-identifier">columns</span>(<span class="ruby-identifier">table_name</span>).<span class="ruby-identifier">find</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">column_name</span>.<span class="ruby-identifier">to_s</span> }
    <span class="ruby-identifier">options</span>[<span class="ruby-value">:default</span>] = <span class="ruby-identifier">column</span>.<span class="ruby-identifier">default</span>
    <span class="ruby-identifier">options</span>[<span class="ruby-value">:null</span>] = <span class="ruby-identifier">column</span>.<span class="ruby-identifier">null</span>
    <span class="ruby-identifier">options</span>[<span class="ruby-value">:auto_increment</span>] = (<span class="ruby-identifier">column</span>.<span class="ruby-identifier">extra</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;auto_increment&quot;</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">raise</span> <span class="ruby-constant">ActiveRecordError</span>, <span class="ruby-node">&quot;No such column: #{table_name}.#{column_name}&quot;</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-identifier">current_type</span> = <span class="ruby-identifier">select_one</span>(<span class="ruby-node">&quot;SHOW COLUMNS FROM #{quote_table_name(table_name)} LIKE '#{column_name}'&quot;</span>, <span class="ruby-string">'SCHEMA'</span>)[<span class="ruby-string">&quot;Type&quot;</span>]
  <span class="ruby-identifier">rename_column_sql</span> = <span class="ruby-node">&quot;CHANGE #{quote_column_name(column_name)} #{quote_column_name(new_column_name)} #{current_type}&quot;</span>
  <span class="ruby-identifier">add_column_options!</span>(<span class="ruby-identifier">rename_column_sql</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">rename_column_sql</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-subquery_for">
            
              <b>subquery_for</b>(key, select)
            
            <a href="AbstractMysqlAdapter.html#method-i-subquery_for" name="method-i-subquery_for" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>MySQL is too stupid to create a temporary table for use subquery, so we
have to give it some prompting in the form of a subsubquery. Ugh!</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-subquery_for_source')" id="l_method-i-subquery_for_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L618" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-subquery_for_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 618</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">subquery_for</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">select</span>)
  <span class="ruby-identifier">subsubselect</span> = <span class="ruby-identifier">select</span>.<span class="ruby-identifier">clone</span>
  <span class="ruby-identifier">subsubselect</span>.<span class="ruby-identifier">projections</span> = [<span class="ruby-identifier">key</span>]

  <span class="ruby-identifier">subselect</span> = <span class="ruby-constant">Arel</span><span class="ruby-operator">::</span><span class="ruby-constant">SelectManager</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">select</span>.<span class="ruby-identifier">engine</span>)
  <span class="ruby-identifier">subselect</span>.<span class="ruby-identifier">project</span> <span class="ruby-constant">Arel</span>.<span class="ruby-identifier">sql</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">subselect</span>.<span class="ruby-identifier">from</span> <span class="ruby-identifier">subsubselect</span>.<span class="ruby-identifier">as</span>(<span class="ruby-string">'__active_record_temp'</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-translate_exception">
            
              <b>translate_exception</b>(exception, message)
            
            <a href="AbstractMysqlAdapter.html#method-i-translate_exception" name="method-i-translate_exception" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-translate_exception_source')" id="l_method-i-translate_exception_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/fc65d31dcad9036255ecb280922ecbe9dc3728f7/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L652" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-translate_exception_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 652</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">translate_exception</span>(<span class="ruby-identifier">exception</span>, <span class="ruby-identifier">message</span>)
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">error_number</span>(<span class="ruby-identifier">exception</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-number">1062</span>
    <span class="ruby-constant">RecordNotUnique</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">exception</span>)
  <span class="ruby-keyword">when</span> <span class="ruby-number">1452</span>
    <span class="ruby-constant">InvalidForeignKey</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">exception</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">super</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    